package com.yzd.learnjava.enumerated;

public enum RoShamBo2 implements Competitor<RoShamBo2>{
	PAPER(Outcome.DRAW,Outcome.LOSE, Outcome.WIN),
	SCISSORS(Outcome.WIN,Outcome.DRAW, Outcome.LOSE),
	ROCK(Outcome.LOSE,Outcome.WIN, Outcome.DRAW);
	
	private Outcome vPAPER;
	private Outcome vSCISSORS;
	private Outcome vROCK;
	RoShamBo2(Outcome paper, Outcome scissors, Outcome rock){
		vPAPER = paper;
		vSCISSORS = scissors;
		vROCK = rock;
	}
	public Outcome compete(RoShamBo2 competetor) {
		switch (competetor) {
		default:
		case PAPER:return vPAPER;
		case SCISSORS:return vSCISSORS;
		case ROCK:return vROCK;
		}
	}
	
	public static void main(String[] args) {
		RoShamBo.play(RoShamBo2.class, 20);
	}
}

interface Competitor<T extends Competitor<T>>{
	Outcome compete(T competetor);
}
